// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.

import Resource from "vue-resource"
import VueAwesomeSwiper from 'vue-awesome-swiper'
import Vue from 'vue'
import App from './App'
import router from './router'
import ddapi from "./auth/ddapi"
import moment from "moment";

Vue.use(VueAwesomeSwiper)
Vue.use(Resource)
Vue.config.productionTip = false

Vue.http.interceptors.push((request, next) => {
  let corpId = localStorage.getItem("corpId");
  let authorization = localStorage.getItem("authorization");
  request.headers.set('corpid', corpId);
  request.headers.set('authorization', authorization);
  next(response => {
    console.log(response.status)
    return response;
  })
})

/////限制字体的个数多余的以省略号代替//////
Vue.filter("text", function (value) {
  if (value.length > 12) {
    return value.slice(0, 12) + "......";
  } else {
    return value
  }
});


///格式化时间////
Vue.filter('dateMoment', function (value, dateType) {
  return moment(value).format(dateType);
})


Vue.prototype.$ddapi = ddapi;


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }

})
